# app/core/init_db.py
# db.py

from beanie import init_beanie
from motor.motor_asyncio import AsyncIOMotorClient

from core.config import settings
from db.models.chat_message import ChatMessageModel
from db.models.inc import SequenceCounter
from db.models.users import UserDocument
from db.models.wx_friends import WxFriendsModel
from db.models.wx_user_model import WxUserModel


# async def init_db():
#     """初始化MongoDB连接和Beanie"""
#     # 创建MongoDB客户端
#     client = AsyncIOMotorClient(settings.MONGODB_URL)
#     # print(settings.MONGODB_URL)
#     # 初始化Beanie，绑定数据库和模型
#     await init_beanie(
#         database=client.get_database("qnn"),
#         document_models=[UserDocument,WxUserModel,SequenceCounter,ChatMessageModel,
#                          WxFriendsModel]  # 注册所有文档模型
#     )



